package chap01;

import java.io.*;


public class AV{
	
public static void main (String[ ] args)  throws Exception{
	AV aV=new AV();
	aV.dol();
}	
public void dol() throws IOException{
	BufferedReader reader=new BufferedReader(new FileReader("C:/LGSInst.Log"));

//	str=reader
//    StringReader reader = new StringReader("this is a test");

    int wordCount = 0;
    StreamTokenizer streamTokenizer = new StreamTokenizer(reader);

    while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
      if (streamTokenizer.ttype == StreamTokenizer.TT_WORD)
        {wordCount++;}
    }
    System.out.println("Number of words in file: " + wordCount);

}
}
//Number of words in file: 4